//品牌管理模块接口
import request from '@/utils/request'
import type {TradeMarkResponseData} from './type'
import {UPDATE_MODEL_EVENT} from 'element-plus'
import {TradeMark} from './type'

//品牌管理模块接口地址
enum API {
    //获取已有品牌接口地址
    TRADEMARK_URL = '/admin/product/baseTrademark/',
    //添加品牌
    ADD_TRADEMARK_URL = '/admin/product/baseTrademark/save',
    //修改已有品牌
    UPDATE_TRADEMARK_URL = '/admin/product/baseTrademark/update',
    //删除品牌
    DELETE_TRADEMARK_URL = '/admin/product/baseTrademark/remove/'
}

//获取已有品牌的接口方法
//page: 获取第几页 ----默认第一页
//limit: 每页大小数据有几条
export const reqGetTrademarkData = (page: number, limit: number) =>
    request.get<any, TradeMarkResponseData>(
        API.TRADEMARK_URL + `${page}/${limit}`,
    )
export const reqAddOrUpdateTrademarkData = (data: TradeMark) => {
    if (data.id) {
        return request.put<any, any>(API.UPDATE_TRADEMARK_URL, data)
    } else {
        return request.post<any, any>(API.ADD_TRADEMARK_URL, data)
    }
}
export const reqDeleteTrademarkData = (id: number) => request.delete<any, any>(API.DELETE_TRADEMARK_URL + `${id}`)
